package com.qfedu.edu.manager;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

/**
 * @author xiaobobo
 * @title: RabbitMQManager
 * @projectName seckill-fy-2401-parent
 * @description: 这个是操作队列的
 * @date 2024/11/12  9:23
 */
@Component
public class RabbitMQManager {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    /**
     * 向工作模型发送数据
     *
     * @param queueName
     * @param message
     */
    public void sendWork(String queueName, String message) throws UnsupportedEncodingException {
        Message message1 = new Message(message.getBytes("UTF-8"), new MessageProperties());
        rabbitTemplate.send(queueName, message1);
    }

}
